package com.kevinwu;

import com.kevinwu.client.RpcConsumer;
import com.kevinwu.service.UserService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * 客户端项目启动类
 */
@SpringBootApplication
public class ZdyRpcConsumerApplication {

    public static void main(String[] args) throws InterruptedException {
        SpringApplication.run(ZdyRpcConsumerApplication.class, args);
        //声明对象
        RpcConsumer rpcConsumer = new RpcConsumer();
        //创建代理对象
        UserService proxy = (UserService) rpcConsumer.createProxy(UserService.class);
        while (true){
            /**
             * 每2秒发哦送一次请求，打印返回结果
             */
            Thread.sleep(2000);
            System.out.println("服务端返回信息："+proxy.sayHello("are you ok?"));
        }
    }

}
